package spotGUI.utils;

import java.awt.Component;

import javax.swing.DefaultListCellRenderer;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;


public class UserPhotoListCellRenderer implements ListCellRenderer {

	private DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
	
	@Override
	public Component getListCellRendererComponent(JList list, Object value,
			int index, boolean isSelected, boolean cellHasFocus) {
		
		Object[] listElement = (Object[])value;
		JLabel listCellRendererComponent = (JLabel)defaultRenderer.getListCellRendererComponent(
				list, value, index, isSelected, cellHasFocus);
		listCellRendererComponent.setIcon((ImageIcon)listElement[3]);
		listCellRendererComponent.setText((String)listElement[1]+" "+(String)listElement[2]);

		return listCellRendererComponent;
	}
}
